package com.hnxxxy.usermgr.controller;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hnxxxy.common.tools.Help;
import com.hnxxxy.common.tools.TableObj;
import com.hnxxxy.usermgr.pojo.User;
import com.hnxxxy.usermgr.service.UserService;
import javafx.scene.control.Tab;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @CLASSDESCRIPER:
 * @AUTHOR:suhui
 * @PHONE:13319575368
 * @EMIAL:13319575368@163.COM
 * @DATE: 2020/3/31
 * @PARAMDESCRIPER:
 * @OUTPARAMDESCRIPER:
 */
@RequestMapping("/user")
@RestController
@Slf4j
public class UserController {

    @Autowired
    private UserService userService;

    @RequestMapping("/1")
    /*
        @RequiresPermissions("888")
    */
    public TableObj findAllUser(TableObj tableObj,User user){
            log.info("参数名："+user.getName());
            PageHelper.startPage(tableObj.getCurr(), tableObj.getNums());
            List<User> list = userService.findAllUser();
            return Help.getPageTableRtn(tableObj,list);
    }

    @RequestMapping("/2")
    public List findUserByName(@RequestParam(value = "name") String name){
       return  userService.findUserByName(name);
    }

}
